package us.mooresr.geartrack.client.events;

import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.EventHandler;
import us.mooresr.geartrack.shared.model.Loan;
import com.google.gwt.event.shared.HasHandlers;

public class LoanDeletedEvent extends
		GwtEvent<LoanDeletedEvent.LoadDeletedHandler> {

	public static Type<LoadDeletedHandler> TYPE = new Type<LoadDeletedHandler>();
	private Loan loan;

	public interface LoadDeletedHandler extends EventHandler {
		void onLoadDeleted(LoanDeletedEvent event);
	}

	public LoanDeletedEvent(Loan loan) {
		this.loan = loan;
	}

	public Loan getLoan() {
		return loan;
	}

	@Override
	protected void dispatch(LoadDeletedHandler handler) {
		handler.onLoadDeleted(this);
	}

	@Override
	public Type<LoadDeletedHandler> getAssociatedType() {
		return TYPE;
	}

	public static Type<LoadDeletedHandler> getType() {
		return TYPE;
	}

	public static void fire(HasHandlers source, Loan loan) {
		source.fireEvent(new LoanDeletedEvent(loan));
	}
}
